package com.ihrm.employee.service.impl;

import com.ihrm.domain.employee.UserCompanyPersonal;
import com.ihrm.domain.employee.response.EmployeeReportResult;
import com.ihrm.employee.mapper.UserCompanyPersonalMapper;
import com.ihrm.employee.service.api.UserCompanyPersonalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 */
@Service
public class UserCompanyPersonalServiceImpl implements UserCompanyPersonalService {
    @Autowired
    private UserCompanyPersonalMapper userCompanyPersonalMapper;

    public void update(UserCompanyPersonal personalInfo) {
        userCompanyPersonalMapper.updateByPrimaryKeySelective(personalInfo);
    }

    @Override
    public void delete(String userId) {
        userCompanyPersonalMapper.deleteByPrimaryKey(userId);
    }

    @Override
    public void insert(UserCompanyPersonal personalInfo) {
        userCompanyPersonalMapper.insertSelective(personalInfo);
    }

    public UserCompanyPersonal findById(String userId) {
        return userCompanyPersonalMapper.selectByPrimaryKey(userId);
    }

    @Override
    public List<EmployeeReportResult> findByReport(String companyId, String month) {
        List<EmployeeReportResult> byReport = userCompanyPersonalMapper.findByReport(companyId, month);
        return byReport;
    }
}
